package net.realsee.common.enums.wcs.intf;

import cn.hutool.core.util.StrUtil;
import cn.hutool.http.Method;

/**
 * Http方法枚举
 *
 * @author 孙正华
 * @since 2023/7/27 13:52
 */
public enum InterfaceMethodEnum {

    GET,
    POST,
    HEAD,
    OPTIONS,
    PUT,
    DELETE,
    TRACE,
    CONNECT,
    PATCH;

    public static boolean contains(String method) {
        for (InterfaceMethodEnum m : InterfaceMethodEnum.values()) {
            if (StrUtil.equalsIgnoreCase(m.name(), method)) {
                return true;
            }
        }
        return false;
    }

    public static Method getMethod(String method) {
        for (Method value : Method.values()) {
            if (StrUtil.equalsIgnoreCase(value.name(), method)) {
                return value;
            }
        }
        return null;
    }
}
